<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>02选择元素和绑定数据</title>
    <script src="./node_modules/d3/dist/d3.min.js"></script>
</head>
<body>
<p>H</p>
<p>E</p>
<p>L</p>
<p>L</p>
<p>O</p>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</body>
</html>
<script>
    const str = 'Hello World'
    const p = d3.selectAll('p')
    p.datum(str)
    p.text((data, i) => {
        return `我是第${i}个${data}`
    })
    const dataset = ["I like dogs", "I like cats", "I like snakes"];
    const div = d3.selectAll('div')
    div.data(dataset)
    div.text((data, i) => {
        return `我是第${i}个${data}`
    })
</script>
